import request from 'UTIL/request'


/**
 * 线索列表
 * @param params
 */
export function GetList(params) {
  return request({
    url: 'crmLeads/queryPageList',
    method: 'POST',
    data: params
  })
}

/**
 * 新增/编辑时查询字段
 */
export function QueryFieldList(params) {
  const query = params && params.id ? `/${params.id}` : ''
  return request({
    url: `crmLeads/field${query}`,
    method: 'POST',
    data: params,
		requestType: 'form'
  })
}

/**
 * 新建线索
 */
export function AddLeads(params) {
  return request({
    url: 'crmLeads/add',
    method: 'POST',
    data: params
  })
}

/**
 * 编辑线索
 */
export function UpdateLeads(params) {
  return request({
    url: 'crmLeads/update',
    method: 'POST',
    data: params
  })
}

/**
 * 线索删除
 * @param params
 */
export function DeleteByIds(params) {
  return request({
    url: 'crmLeads/deleteByIds',
    method: 'POST',
    data: params
  })
}

/**
 * 线索详情
 * @param params
 */
export function QueryById(params) {
  return request({
    url: `crmLeads/queryById/${params.leadsId}`,
    method: 'POST',
    data: params
  })
}

/**
 * 基本信息
 */
export function InformationById(params) {
  return request({
    url: `crmLeads/information/${params.id}`,
    method: 'POST',
    data: params
  })
}

/**
 * 线索转移
 * @param params
 */
export function ChangeOwnerUser(params) {
  return request({
    url: 'crmLeads/changeOwnerUser',
    method: 'POST',
    data: params
  })
}

/**
 * 线索转换为客户
 * @param params
 */
export function Transfer(params) {
  return request({
    url: 'crmLeads/transfer',
    method: 'POST',
    data: params
  })
}

/**
 * 添加跟进记录
 * @param params
 */
export function AddRecord(params) {
  return request({
    url: 'crmLeads/addRecord',
    method: 'POST',
    data: params
  })
}

/**
 * 查看跟进记录
 * @param params
 */
export function GetRecord(params) {
  return request({
    url: 'crmLeads/getRecord',
    method: 'POST',
    data: params
  })
}

/**
 * 查询线索下附件列表
 * @param params
 */
export function QueryFileList(params) {
  return request({
    url: 'crmLeads/queryFileList',
    method: 'POST',
    data: params,
		header: {
			'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
		}
  })
}
